package com.clp.protocol.iec104.iec104.server.slavechannel.pipeline.state.data;

import com.clp.protocol.iec104.iec104.definition.TypeTag;
import com.clp.protocol.iec104.iec104.server.slavechannel.SlaveChannel;
import lombok.Getter;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;

/**
 * 遥控数据反应器
 */
@Getter
public abstract class TcDataReactor extends DataReactor {
    private final TcType tcType;

    public TcDataReactor(Executor executor, TcType tcType) {
        super(executor);
        this.tcType = tcType;
    }

    /**
     * 是否接受遥控选择
     * @param slaveChannel
     * @return
     */
    public abstract CompletableFuture<Boolean> acceptSelect(SlaveChannel slaveChannel);

    /**
     * 是否接受遥控执行
     * @param slaveChannel
     * @return
     */
    public abstract CompletableFuture<Boolean> acceptExecute(SlaveChannel slaveChannel);

    @Getter
    public enum TcType {
        ONE_POINT(TypeTag.C_SC_NA_1),
        TWO_POINT(TypeTag.C_DC_NA_1);

        private final TypeTag typeTag;

        TcType(TypeTag typeTag) {
            this.typeTag = typeTag;
        }
    }

}
